<extend name="Public/base" />

<block name="body">
    <!-- 标题栏 -->
    <div class="main-title">
        <h2><notempty name = "uname"><span style = "color:red">{$uname.nickname}</span>的资金汇总<else/>资金汇总</notempty></h2>

    </div>
    <div class="cf">
        <!-- 高级搜索 -->
        <div class="search-form fr cf">
          <div class="sleft">
              <input type="text" name="nickname" class="search-input" value="{:I('nickname')}" placeholder="昵称">
          </div>
            <div class="sleft">
                <input type="text" id="begin_time" name="start_time" class="search-input" value="{:I('start_time')}" placeholder="起始时间">
            </div>
            <div style = "float:left;line-height:30px;margin-right:10px;">至</div>
            <div class="sleft">
                <input type="text" id="end_time" name="end_time" class="search-input" value="{:I('end_time')}" placeholder="结束时间">
            </div>
            <div class="sleft">
                <a class="sch-btn" href="javascript:;" id="search" url="{:U('index')}"><i class="btn-search"></i></a>
            </div>
        </div>
    </div>
    <!-- 数据列表 -->
    <div class="data-table table-striped">
        <h3>资金汇总</h3>
        <table class="">
          <thead>
            <tr>
      				<th>欧元订单</th>
      				<th>恒指订单</th>
      				<th>螺纹钢订单</th>
              <th>用户总盈亏</th>
      				<th>提现</th>
              <th>提现手续费</th>
      				<th>充值</th>
              <th>充值手续费</th>
      				<th>佣金</th>
              <th>公司盈亏</th>
              <th>操作</th>
      			</tr>
          </thead>
          <tbody>
              <tr class="table-nobg">
                  <td>{$profit.oy_order.sum}  元</td>
                  <td>{$profit.order.sum}  元</td>
                  <td>{$profit.odr.sum}  元</td>
                  <td>{$profit.pal}  元</td>
                  <td>{$profit.cash.sum}  元</td>
                  <td>{$profit.cash.hsum}  元</td>
                  <td>{$profit.rec.sum}  元</td>
                  <td>{$profit.rec.sxf}  元</td>
                  <td>{$profit.cms.sum}  元</td>
                  <td>{$profit.corporate.pal}  元</td>
                  <td>
        							<a href = "{:U('FuturesUserSummary/index?op=display')}">查看详情</a>
        					</td>
        			</tr>
          </tbody>
        </table>
    </div>
    <div class="data-table table-striped">
        <h3>用户资金</h3>
        <table class="">
          <thead>
            <tr>
              <th>id</th>
              <th>用户昵称</th>
      				<th class = "sort" data = "oyorder">欧元订单</th>
      				<th class = "sort" data = "order">恒指订单</th>
      				<th class = "sort" data = "odr">螺纹钢订单</th>
              <th class = "sort" data = "pal">用户盈亏</th>
      				<th class = "sort" data = "cash">提现</th>
              <th class = "sort" data = "hsum">提现手续费</th>
      				<th class = "sort" data = "rec">充值</th>
              <th class = "sort" data = "sxf">充值手续费</th>
      				<th class = "sort" data = "cms">佣金</th>
      				<th>操作</th>
      			</tr>
          </thead>
          <tbody>
              <foreach name="user_data" item="vo" key = "key">
              <tr class="table-nobg">
                  <td>{$vo.id}</td>
                  <td>{$vo.nickname}</td>
        					<td>{$vo.oyorder}  元</td>
        					<td>{$vo.order}  元</td>
        					<td>{$vo.odr}  元</td>
                  <td>{$vo.pal}  元</td>
        					<td>{$vo.cash}  元</td>
                  <td>{$vo.hsum}  元</td>
        					<td>{$vo.rec}  元</td>
                  <td>{$vo.sxf}  元</td>
        					<td>{$vo.cms}  元</td>
                  <td>
        							<a href = "{:U('FuturesUserSummary/index?id='.$vo['id'])}">查看详情</a>
        					</td>
        			</tr>
        			</foreach>
          </tbody>
        </table>
    </div>
    <div class="page">
        {$show}
    </div>
</block>

<block name="script">
    <link href="__STATIC__/datetimepicker/css/datetimepicker.css?v={:SITE_VERSION}" rel="stylesheet" type="text/css">
    <php>if(C('COLOR_STYLE')=='blue_color') echo '<link href="__STATIC__/datetimepicker/css/datetimepicker_blue.css?v={:SITE_VERSION}" rel="stylesheet" type="text/css">';</php>
    <link href="__STATIC__/datetimepicker/css/dropdown.css?v={:SITE_VERSION}" rel="stylesheet" type="text/css">
    <script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
    <script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js?v={:SITE_VERSION}" charset="UTF-8"></script>
    <script src="__STATIC__/thinkbox/jquery.thinkbox.js?v={:SITE_VERSION}"></script>
    <script type="text/javascript">
        $('#begin_time,#end_time,#create_time,#start_time').datetimepicker({
            format: 'yyyy-mm-dd',
            language:"zh-CN",
            minView:2,
            autoclose:true,
        });
        //搜索功能
        $("#search").click(function(){
            var url = $(this).attr('url');
            url = url.substr(0,url.lastIndexOf('.'));
            var query  = $('.search-form').find('input').serialize();
            var status=$('#status').val();
            query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
            query = query.replace(/^&/g,'');
            query+="/status/"+status;
            query = query.replace(/=/gm,"/");
            query = query.replace(/&/gm,"/");
            if( url.indexOf('?')>0 ){
            	if(query.substr(0,1) != "/"){
            		url += "/"+query;
            	}else{
            		url += query;
            	}
            }else{
                url += "/" + query;
            }

            //alert(url);
            window.location.href = url;
        });
        //回车搜索
        $(".search-input").keyup(function(e){
            if(e.keyCode === 13){
                $("#search").click();
                return false;
            }
        });
        //导航高亮
        $('.side-sub-menu').find('a[href="{:U('FuturesUserSummary/index')}"]').closest('li').addClass('current');
    </script>
    <script>
      $(".sort").mouseover(function(){
        $(this).css("cursor","pointer");
      })
      $(".sort").click(function(){
        var sort = $(this).attr('data');
        var url = "{:U('FuturesUserSummary/index')}"
        var sort_s = "{:I('get.sort_s')}";
        url = url.substr(0,url.lastIndexOf('.'));
        if(sort_s == 1){
          var sort_s = 2;
        }else {
          var sort_s = 1;
        }
        url +=  "/sort/"+sort+"/sort_s/"+sort_s;
        window.location.href = url;
        /*$.post(url,$("this").attr('data'),function(data){

            }
          );*/
      })
    </script>
</block>
